<!--
 * @Author: zsc
 * @Date: 2022-06-13 21:56:52
 * @LastEditors: zsc
 * @LastEditTime: 2022-07-26 01:00:45
 * @Description:个人侧预警
-->

<template>
  <page>
    <span slot="other" style="margin:20px;font-size:30px">个人侧预警</span>
    <!--    查询条件-->
    <el-row slot="where">

      <el-col :span="24" class="k-text-left">

        <span>姓名/身份证</span>
        <el-input v-model="WHERE.search" class="k-width-150-p k-mr-10" />
        <el-button type="primary" @click="_search">查询</el-button>
        <el-button type="primary" @click="_reset">重置</el-button>
      </el-col>
    </el-row>
    <!--    表格-->
    <el-table
      slot="table"
      ref="tb"
      v-loading="LOADING"
      :data="CLASS_TABLE_DATA"
      :size="SIZE"
      border
      :height="LIST_HEIGHT"
      style="width: 100%"
      @selection-change="_handleSelectionChange"
    >
      <el-table-column
        type="selection"
        width="55"
      />
      <template v-for="(item) in setting">
        <el-table-column
          v-if="item.key === 'action'"
          :key="item.id"
          :label="item.name"
          :prop="item.key"
          :width="item.value"
          :fixed="item.fixed"
        >
          <template slot-scope="scope">
            <el-button @click="handleTrack(scope.row)">展开轨迹</el-button>
            <!-- <el-button>异常原因</el-button> -->
            <el-button v-permission="['ABNORMAL:USER:CANCEL']" @click="handleRelieveWarning(scope.row)">解除异常</el-button>
            <el-button @click="handleEdit(scope.row)">个人资料</el-button>
          </template>

        </el-table-column>
        <el-table-column
          v-else
          :key="item.id"
          :label="item.name"
          :prop="item.key"
          :width="item.value"
        />
      </template>
    </el-table>
    <!--    分页-->
    <pagination slot="pagination" />
    <!--    弹窗-->
    <template slot="modal">
      <track-modal :visible.sync="trackVisible" :idcard="idcard" :name="name" />
    </template>
  </page>
</template>

<script>
import list from '@/list'
import PersonClass from '@/models/warning-preson-class'
import { getWarningList, relieveWarning } from '@/api/warning'
import trackModal from './track'
const personClass = new PersonClass()
export default {
  name: 'DeepInterpretationOrder',
  components: { trackModal },
  mixins: [list],
  props: {

    companyId: {
      type: Number,
      default: 0
    }

  },
  data() {
    return {
      caseRequestURLType: '',
      idcard: '',
      name: '',
      trackVisible: false,
      setting: personClass.list(),
      WHERE: {
        search: '',
        status: 2
      }
    }
  },
  created() {
    this.LIST_API = getWarningList
  },
  mounted() {

  },
  methods: {
    handleEdit(item) {
      console.log('个人资料')
    },
    handleTrack(item) {
      console.log('轨迹列表')
      this.trackVisible = true
      this.idcard = item.user_info.id_card
      this.name = item.user_info.real_name
    },
    handleRelieveWarning(item) {
      console.log('解除预警')
      this.$confirm('确认解除预警？')
        .then(_ => {
          relieveWarning({ id: item.id, note: '' }).then(p => {
            this._showSuccess('操作成功')
            this._search()
          })
        })
        .catch(_ => {
        })
      console.log('删除', item)
    }
  }
}
</script>
